*** E5 Fuel ***
graph drop _all

**  Station 22


use "$P_Data/break_pccount/Separate/22_e5.dta", clear
quietly capture tsset y2kW
quietly merge 1:1 y2kW using "$P_Data_Processed/weekly_oil.dta"
quietly capture keep if _merge==3 
quietly capture drop _merge

quietly capture reg PCCount oil_eur
quietly capture estat sbsingle, breakvars(, const) gener(Fstat)
egen max_Fstat = max(Fstat)
sort y2kW
merge m:1 y2kW using  "$P_Data_Processed/week_y2kW_concordance.dta"
drop if _merge==2
drop _merge

gener max_date = weekly_date  if max_Fstat==Fstat
sort max_date
local m_date = max_date[1]

sort weekly_date
format weekly_date %tw

tw (line Fstat weekly_date), tline(`m_date') xtitle("Date") ytitle("Fstat") title("(a) Station 22 (Esso)") name(d3_a)

**  Station 29


use "$P_Data/break_pccount/Separate/29_e5.dta", clear
quietly capture tsset y2kW
quietly merge 1:1 y2kW using "$P_Data_Processed/weekly_oil.dta"
quietly capture keep if _merge==3 
quietly capture drop _merge

quietly capture reg PCCount oil_eur
quietly capture estat sbsingle, breakvars(, const) gener(Fstat)

egen max_Fstat = max(Fstat)
sort y2kW
merge m:1 y2kW using  "$P_Data_Processed/week_y2kW_concordance.dta"
drop if _merge==2
drop _merge

gener max_date = weekly_date  if max_Fstat==Fstat
sort max_date
local m_date = max_date[1]

sort weekly_date
format weekly_date %tw

tw (line Fstat weekly_date), tline(`m_date') xtitle("Date") ytitle("Fstat") title("(b) Station 29 (Hem)") name(d3_b)

**  Station 31


use "$P_Data/break_pccount/Separate/31_e5.dta", clear
quietly capture tsset y2kW
quietly merge 1:1 y2kW using "$P_Data_Processed/weekly_oil.dta"
quietly capture keep if _merge==3 
quietly capture drop _merge

quietly capture reg PCCount oil_eur
quietly capture estat sbsingle, breakvars(, const) gener(Fstat)

egen max_Fstat = max(Fstat)
sort y2kW
merge m:1 y2kW using  "$P_Data_Processed/week_y2kW_concordance.dta"
drop if _merge==2
drop _merge

gener max_date = weekly_date  if max_Fstat==Fstat
sort max_date
local m_date = max_date[1]

sort weekly_date
format weekly_date %tw

tw (line Fstat weekly_date), tline(`m_date') xtitle("Date") ytitle("Fstat") title("(c) Station 31 (Shell)") name(d3_c)

**  Station 163


use "$P_Data/break_pccount/Separate/163_e5.dta", clear
quietly capture tsset y2kW
quietly merge 1:1 y2kW using "$P_Data_Processed/weekly_oil.dta"
quietly capture keep if _merge==3 
quietly capture drop _merge

quietly capture reg PCCount oil_eur
quietly capture estat sbsingle, breakvars(, const) gener(Fstat)

egen max_Fstat = max(Fstat)
sort y2kW
merge m:1 y2kW using  "$P_Data_Processed/week_y2kW_concordance.dta"
drop if _merge==2
drop _merge

gener max_date = weekly_date  if max_Fstat==Fstat
sort max_date
local m_date = max_date[1]

sort weekly_date
format weekly_date %tw

tw (line Fstat weekly_date), tline(`m_date') xtitle("Date") ytitle("Fstat") title("(d) Station 163 (ARAL)") name(d3_d)


graph combine d3_a d3_b d3_c d3_d 

graph export "$P_Figures/Figure_D3.eps", replace 




